package cn.xinfei.xdecision.common.model.common.requestParam;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.util.CollectionUtils;

import java.util.List;

import static cn.xinfei.xdecision.common.utils.exception.enums.ErrorCodeEnum.PARAM_CHECK_ERROR;
import static cn.xinfei.xdecision.common.utils.exception.util.ApiExceptionUtil.exception;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors
public class UpdateStatusParam {

    private Integer status;

    private List<Long> list;

    public void paramsCheck() {
        if (CollectionUtils.isEmpty(this.list)) {
            throw exception(PARAM_CHECK_ERROR, "id列表为空");
        }
        if (this.status == null) {
            throw exception(PARAM_CHECK_ERROR, "更新状态为空");
        }
    }

}
